home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-08-19 | 59.7 KB | 1,930 lines |
- Newsgroups: comp.sources.misc
- subject: v08i001: A HELP facility for Unix
- From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Reply-To: nelson@uncecs.edu (jim nelson)
-
- Posting-number: Volume 8, Issue 1
- Submitted-by: nelson@uncecs.edu (jim nelson)
- Archive-name: help.jn
-
- Here is a little Help-facility somewhat like some other operating
- systems provide. It's sorta crude at the moment, but it works well.
- It runs under BSD, Xenix, and SysV, although I still don't know quite
- how to do "my own pager" under Xenix or SysV. If this has been done
- before in the recent past, don't post, just trash. However, I kinda
- like it, and we (I) plan to spring it on our freshmen due to arrive in
- a couple of weeks.
- ---------------- cut here -----------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: C-mistakes.txt MANIFEST Makefile README ac.txt af.txt
- # ap.txt apropos.txt bye.txt cat.txt cbreak.c cc.txt cd.txt
- # compilers.txt copy.txt cp.txt csh.txt dir.txt ed.txt edit.txt
- # exit.txt files files.txt files/a.out.txt files/binaries
- # files/binaries.txt files/binaries/a.out.txt
- # files/binaries/executables.txt files/filenames.txt files/pwd.txt
- # files/sources.txt fortran.txt games.txt guru guru.1 guru.txt
- # help.c help.txt igors igors.1 igors.txt kindex.c languages.txt
- # learn.txt less.txt listfd.c listit.c logoff.txt logout.txt
- # mail.txt man.txt manual.txt mv.txt mymode.c news.txt nocbreak.c
- # off.txt pascal.txt passwd.txt phone.txt pwd.txt quit.txt
- # rename.txt stat.c talk.txt terminal.txt test.txt ulgrp vi.txt
- # Wrapped by nelson@uncw on Fri Aug 11 19:08:51 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'C-mistakes.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'C-mistakes.txt'\"
- else
- echo shar: Extracting \"'C-mistakes.txt'\" \(3196 characters\)
- sed "s/^X//" >'C-mistakes.txt' <<'END_OF_FILE'
- X
- XA few of Dr. Doom's list of C-gotchas, condensed considerably from the
- Xoriginals:
- X
- X1. EOF is an int, not a char; "getchar()", despite its
- Xcharacter-sounding name, RETURNS AN INT! In fact, all functions in the
- XC language return either an int or a double; it is not possible to
- Xwrite a function which returns a char. Besides, the compiler generates
- Xcode which takes the same amount of space for (scalar) chars and ints.
- XSo: there is NEVER any reason to say, for example: "char c;". You
- Xshould ALWAYS declare c to be an int, especially when it receives the
- Xreturn value from getchar, which is then compared to EOF.
- X
- XExamples:
- X
- X /* this is WRONG (WRONG!, WRONG!, WRONG! ...*/
- X char c;
- X while( (c=getchar()) != EOF){ ... }
- X
- X /* this is RIGHT */
- X int c;
- X while( (c=getchar()) != EOF){ ... }
- X
- X----------------------------------------------------
- X
- X2. Beware the distinction between "=" and "==". The single-
- Xequal-sign (we'll call it SE) causes the things on the two sides of it
- Xto BECOME equal; the resultant value is then whatever value was
- Xoriginally on the right-hand-side of the SE operator. The double-equal
- Xsign (DE) first tests the two sides to see if they are equal; the
- Xresulting value of the DE operator is zero if they are not equal, and
- Xone if they are equal. No other results are possible.
- X
- XExamples:
- X
- X /* this is (probably) WRONG */
- X int i,j;
- X if(i=j){ ... } /*will execute if j is nonzero */
- X
- X /* this is (probably) RIGHT */
- X int i,j;
- X if(i==j){ ... } /*will execute if i is equal to j */
- X
- X----------------------------------------------------
- X
- X3. Even experienced programmers sometimes forget the "&"s which
- Xare required on the arguments to scanf. All arguments after the
- Xfirst must have "&" in front of it.
- X
- XExamples:
- X /* WRONG ... guaranteed to dump core */
- X int i;
- X scanf("%d",i);
- X
- X /* RIGHT */
- X int i;
- X scanf("%d",&i);
- X
- X /* for advanced students only: */
- X int j, *i = &j;
- X scanf("%d",i);
- X printf("%d %d\n",i,j); /* what does it print? */
- X
- X----------------------------------------------------
- X
- X4. Beware the extraneous semicolon.
- X
- X /* (probably) WRONG */
- X for(i=0; i<10; i++);
- X printf("%d\n",i);
- X
- X /* (probably) RIGHT */
- X for(i=0; i<10; i++)
- X printf("%d\n",i);
- X
- X----------------------------------------------------
- X
- X5. Again, even experienced programmers sometimes (Hi, Chris!)
- Xget bit by the "dangling else" bug:
- X
- X if(i==5)
- X k=7;
- X if (line==27) d = 39;
- X else
- X d = 41;
- X
- Xand variations too numerous to show here. The "else" goes with the
- Xnearest preceding "if" (well, actually, the nearest preceding
- X"if" that doesn't already have an "else" associated with it).
- XThe compiler does not know indentation.
- X
- X----------------------------------------------------
- X
- X6. Scanf() from the terminal can produce some perplexing results
- Xuntil you learn about "the terminating newline", and what scanf
- Xconsiders to be whitespace for %d, %s, and %c formats. Primarily
- Xtry to remember that for a "%d" format, scanf IGNORES leading
- Xwhitespace, and PUTS BACK the whitespace which caused the termination
- Xof a "%d" scan. Moral of the story: "do not mix %c and %s formats
- Xwith %d or %f formats, nor mix scanf with getchar, unless you are
- Xvery careful AND know what you're doing."
- END_OF_FILE
- if test 3196 -ne `wc -c <'C-mistakes.txt'`; then
- echo shar: \"'C-mistakes.txt'\" unpacked with wrong size!
- fi
- # end of 'C-mistakes.txt'
- fi
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(2258 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X C-mistakes.txt 1
- X MANIFEST 1 This shipping list
- X Makefile 1
- X README 1
- X ac.txt 1
- X af.txt 1
- X ap.txt 1
- X apropos.txt 1
- X bye.txt 1
- X cat.txt 1
- X cbreak.c 1
- X cc.txt 1
- X cd.txt 1
- X compilers.txt 1
- X copy.txt 1
- X cp.txt 1
- X csh.txt 1
- X dir.txt 1
- X ed.txt 1
- X edit.txt 1
- X exit.txt 1
- X files 1
- X files.txt 1
- X files/a.out.txt 1
- X files/binaries 1
- X files/binaries.txt 1
- X files/binaries/a.out.txt 1
- X files/binaries/executables.txt 1
- X files/filenames.txt 1
- X files/pwd.txt 1
- X files/sources.txt 1
- X fortran.txt 1
- X games.txt 1
- X guru 1
- X guru.1 1
- X guru.txt 1
- X help.c 1
- X help.txt 1
- X igors 1
- X igors.1 1
- X igors.txt 1
- X kindex.c 1
- X languages.txt 1
- X learn.txt 1
- X less.txt 1
- X listfd.c 1
- X listit.c 1
- X logoff.txt 1
- X logout.txt 1
- X mail.txt 1
- X man.txt 1
- X manual.txt 1
- X mv.txt 1
- X mymode.c 1
- X news.txt 1
- X nocbreak.c 1
- X off.txt 1
- X pascal.txt 1
- X passwd.txt 1
- X phone.txt 1
- X pwd.txt 1
- X quit.txt 1
- X rename.txt 1
- X stat.c 1
- X talk.txt 1
- X terminal.txt 1
- X test.txt 1
- X ulgrp 1
- X vi.txt 1
- END_OF_FILE
- if test 2258 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(1399 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X#Makefile for "help"
- X
- X#for Sequent parallel make:
- XP=&
- X
- X#Define OLDDIR if you do not have opendir(), readdir(), etc.,
- X# and your directories are of the 16-byte, 14-character-name variety.
- X#Define SYSV if you must :-).
- X#Note that SYSV and OLDDIR are not necessarily related;
- X# at least one version of Xenix that I know of requires both,
- X# and at least one version of SysV has the new directory stuff.
- XCFLAGS=#-O #-DSYSV #-DOLDDIR
- X#CC=gcc
- X
- X
- X#directory where the "*.txt" files should live (most people would
- X# use /usr/lib/help, but it really doesn't matter).
- XLIB=/usr/lib/help
- X#the full pathname of the executable (in everyone's path (?)).
- XEXE=/usr/local/bin/help
- X
- XSRC= help.c mymode.c listfd.c kindex.c listit.c cbreak.c nocbreak.c
- XBIN= help.o mymode.o listfd.o kindex.o listit.o cbreak.o nocbreak.o
- Xhelpx: $(P) $(BIN)
- X $(CC) -o helpx $(BIN)
- Xinstall: helpx
- X strip helpx
- X mv helpx $(EXE)
- X -mkdir $(LIB)
- X -mkdir $(LIB)/files
- X -mkdir $(LIB)/files/binaries
- X -cp ./*.txt $(LIB)
- X -cp ./files/*.txt $(LIB)/files
- X -cp ./files/binaries/*.txt $(LIB)/files/binaries
- X -cp *.1 /usr/man/man1
- X
- Xlint: $(SRC)
- X lint $(CFLAGS) -DLIBDIR=\"$(LIB)\" -cpbh $(SRC)
- X lint -cpbh stat.c
- Xshar:
- X makekit -m README Makefile $(SRC) *.txt stat.c \
- X files files/*.txt \
- X files/binaries files/binaries/*.txt \
- X guru.1 igors.1 guru igors ulgrp
- Xhelp.o: help.c
- X $(CC) -c $(CFLAGS) -DLIBDIR=\"$(LIB)\" help.c
- Xclean:
- X /bin/rm -f *.o helpx
- END_OF_FILE
- if test 1399 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(2264 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X
- XA cheap/simple/quick/dirty HELP facility for Unix.
- X
- XThe maintainer need only add ".txt" files with the proper name
- Xin the proper place in order to add help-blurbs. It has hierarchial
- X"Further help on ..." implemented by the hierarchial file structure
- Xof the directory in which the help-files live. Also, the man-pages
- Xare available from within the facility, without dropping back
- Xto the shell level.
- X
- XTwo compile-time options: SYSV and OLDDIR, in the CFLAGS= line
- Xof the Makefile.
- X
- XTo make: look at the first thirty or so lines of Makefile.
- XThen make. Then make install.
- X
- XIt has been tested and works on:
- X1) Sequent Dynix 3.0.14 (BSD4.2 knockoff), and
- X2) SysV on an AT&T 6386 box (SysV version unknown, but it
- X did have the new-directory goodies), and
- X3) Xenix on a Tandy box. Mostly SysV, but without the directory
- X goodies.
- X
- XBut one note of warning: I've included my "Sequent with cc" versions
- Xof cbreak() and nocbreak(). They most likely will not work for you.
- XThey don't even work for me even using the gcc compiler. This is
- Xbecause of some weird property of the cc preprocessor dealing with
- XTIOCGETP and TIOCSETP macros. The header files make sendmail.cf look
- Xlike a McGuffey's Reader. If you want to save your users a few
- Xkeystrokes at the --more-- prompt, figure out how to do it on YOUR
- Xsystem. Try crmode(), etc., with the curses/termcap/termlib libraries,
- Xif you have them. I wash my hands of the whole thing. The "eat
- Xuntil newline" nocbreak() I send seems to work ok, but not pleasing.
- X
- XYou may have to become root if you want to install the executable in
- Xeverybody's path; otherwise no big deal. The data files can live
- Xanywhere you decide to put them.
- X
- XN.B.: I'm sure this has been done somewhere, sometime, many times
- Xbefore, and can be had on some DECUS tape or USENIX tape or can be
- Xftp'ed from xx.xx.xx.xx, etc., but what the heck, here it is, trash it
- Xif it's worthless, the price is right! I wrote it because I didn't
- Xhave access to said sources, etc., and besides, it was fun. Public
- XDomain. jhn -- 11 Aug 89.
- X --
- XJim Nelson,UNC-Wilmington,Mathematical Sciences Dept,
- X919-395-3300 nelson@uncw.uucp or nelson@ecsvax.uncecs.edu or
- Xnelson@ecsvax.bitnet or {...,mcnc}!ecsvax!nelson
- Xor {...,mcnc}!ecsvax!uncw!nelson
- END_OF_FILE
- if test 2264 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'ac.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ac.txt'\"
- else
- echo shar: Extracting \"'ac.txt'\" \(518 characters\)
- sed "s/^X//" >'ac.txt' <<'END_OF_FILE'
- XThe three programs "ap", "ac", and "af", are somewhat reminiscent
- Xof PC compilers, in that they will compile, edit, compile, edit,
- Xcompile, edit, ... ad nauseam, without ever dropping you back to
- Xthe shell. They also (and here is their usefulness) merge your
- Xerror messages back into your source file, let you fix your
- Xsource, and then remove the messages, all by black magic! Authored
- Xby Dr. Doom in response to the the "draw a little hand with a finger
- Xpointing to the mistake" syndrome of some popular computers.
- END_OF_FILE
- if test 518 -ne `wc -c <'ac.txt'`; then
- echo shar: \"'ac.txt'\" unpacked with wrong size!
- fi
- # end of 'ac.txt'
- fi
- if test -f 'af.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'af.txt'\"
- else
- echo shar: Extracting \"'af.txt'\" \(518 characters\)
- sed "s/^X//" >'af.txt' <<'END_OF_FILE'
- XThe three programs "ap", "ac", and "af", are somewhat reminiscent
- Xof PC compilers, in that they will compile, edit, compile, edit,
- Xcompile, edit, ... ad nauseam, without ever dropping you back to
- Xthe shell. They also (and here is their usefulness) merge your
- Xerror messages back into your source file, let you fix your
- Xsource, and then remove the messages, all by black magic! Authored
- Xby Dr. Doom in response to the the "draw a little hand with a finger
- Xpointing to the mistake" syndrome of some popular computers.
- END_OF_FILE
- if test 518 -ne `wc -c <'af.txt'`; then
- echo shar: \"'af.txt'\" unpacked with wrong size!
- fi
- # end of 'af.txt'
- fi
- if test -f 'ap.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ap.txt'\"
- else
- echo shar: Extracting \"'ap.txt'\" \(518 characters\)
- sed "s/^X//" >'ap.txt' <<'END_OF_FILE'
- XThe three programs "ap", "ac", and "af", are somewhat reminiscent
- Xof PC compilers, in that they will compile, edit, compile, edit,
- Xcompile, edit, ... ad nauseam, without ever dropping you back to
- Xthe shell. They also (and here is their usefulness) merge your
- Xerror messages back into your source file, let you fix your
- Xsource, and then remove the messages, all by black magic! Authored
- Xby Dr. Doom in response to the the "draw a little hand with a finger
- Xpointing to the mistake" syndrome of some popular computers.
- END_OF_FILE
- if test 518 -ne `wc -c <'ap.txt'`; then
- echo shar: \"'ap.txt'\" unpacked with wrong size!
- fi
- # end of 'ap.txt'
- fi
- if test -f 'apropos.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'apropos.txt'\"
- else
- echo shar: Extracting \"'apropos.txt'\" \(151 characters\)
- sed "s/^X//" >'apropos.txt' <<'END_OF_FILE'
- XApropos will search the title lines of the manual pages looking
- Xfor a keyword. It will then tell you those commands which are
- Xfound. See also "man".
- END_OF_FILE
- if test 151 -ne `wc -c <'apropos.txt'`; then
- echo shar: \"'apropos.txt'\" unpacked with wrong size!
- fi
- # end of 'apropos.txt'
- fi
- if test -f 'bye.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'bye.txt'\"
- else
- echo shar: Extracting \"'bye.txt'\" \(273 characters\)
- sed "s/^X//" >'bye.txt' <<'END_OF_FILE'
- XYou log off the Unix machines by typing control-d at the
- Xcommand line prompt. (To type control-d, you HOLD DOWN the
- X"control" key WHILE typing "d"; this is not a two-stroke
- Xsequence -- it's a one-keystroke sequence made by holding
- Xdown the first while typing the second).
- END_OF_FILE
- if test 273 -ne `wc -c <'bye.txt'`; then
- echo shar: \"'bye.txt'\" unpacked with wrong size!
- fi
- # end of 'bye.txt'
- fi
- if test -f 'cat.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cat.txt'\"
- else
- echo shar: Extracting \"'cat.txt'\" \(212 characters\)
- sed "s/^X//" >'cat.txt' <<'END_OF_FILE'
- XThe program to "concatenate" multiple files is called "cat".
- XUsage:
- X$ cat file1 file2 file3 ... > outputfile
- X
- XBe careful that "outputfile" is not the same as any of the other
- Xfiles. If it is, it will be LOST!!
- X
- END_OF_FILE
- if test 212 -ne `wc -c <'cat.txt'`; then
- echo shar: \"'cat.txt'\" unpacked with wrong size!
- fi
- # end of 'cat.txt'
- fi
- if test -f 'cbreak.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cbreak.c'\"
- else
- echo shar: Extracting \"'cbreak.c'\" \(490 characters\)
- sed "s/^X//" >'cbreak.c' <<'END_OF_FILE'
- X#ifdef sequent
- X#include <stdio.h>
- X#include <sgtty.h>
- X
- Xcbreak()
- X{
- X int i;
- X extern int errno;
- X struct sgttyb ttystatus;
- X char *a;
- X /* it is seemingly impossible to get lint to shut
- X up about this: */
- X a= &ttystatus.sg_ispeed;
- X errno=0;
- X i=ioctl(0,TIOCGETP,a);
- X if(i<0)
- X {int me;me=errno;fprintf(stderr,"errno %d\n",me);exit(3);}
- X
- X#define F ttystatus.sg_flags
- X F |= CBREAK;
- X i=ioctl(0,TIOCSETP,a);
- X if(i<0)
- X {int me;me=errno;fprintf(stderr,"errno %d\n",me);exit(4);}
- X}
- X#else
- Xcbreak(){}
- X#endif
- END_OF_FILE
- if test 490 -ne `wc -c <'cbreak.c'`; then
- echo shar: \"'cbreak.c'\" unpacked with wrong size!
- fi
- # end of 'cbreak.c'
- fi
- if test -f 'cc.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cc.txt'\"
- else
- echo shar: Extracting \"'cc.txt'\" \(155 characters\)
- sed "s/^X//" >'cc.txt' <<'END_OF_FILE'
- XThe command to compile a C-language program is
- X$ cc filename.c
- XThe resulting executable will be left in "a.out" in your directory.
- XTo run it, type
- X$ a.out
- END_OF_FILE
- if test 155 -ne `wc -c <'cc.txt'`; then
- echo shar: \"'cc.txt'\" unpacked with wrong size!
- fi
- # end of 'cc.txt'
- fi
- if test -f 'cd.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cd.txt'\"
- else
- echo shar: Extracting \"'cd.txt'\" \(269 characters\)
- sed "s/^X//" >'cd.txt' <<'END_OF_FILE'
- X"cd" means "change directory". That is, change to that directory
- Xso that it becomes the default directory. Usage example:
- X% cd /usr2/nelson
- Xcauses all further commands which refer to the default directory
- Xto look in /usr2/nelson first. To return home, just say
- X% cd
- END_OF_FILE
- if test 269 -ne `wc -c <'cd.txt'`; then
- echo shar: \"'cd.txt'\" unpacked with wrong size!
- fi
- # end of 'cd.txt'
- fi
- if test -f 'compilers.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'compilers.txt'\"
- else
- echo shar: Extracting \"'compilers.txt'\" \(283 characters\)
- sed "s/^X//" >'compilers.txt' <<'END_OF_FILE'
- XThere are three officially supported languages on this machine:
- XFORTRAN, C, and Pascal. Ada is on loan from Sequent, and may
- Xbe returned at any time. Awk and Perl may be considered by some
- Xto be languages. We do not have BASIC, nor are we ever likely to.
- XC++ may be coming later.
- END_OF_FILE
- if test 283 -ne `wc -c <'compilers.txt'`; then
- echo shar: \"'compilers.txt'\" unpacked with wrong size!
- fi
- # end of 'compilers.txt'
- fi
- if test -f 'copy.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'copy.txt'\"
- else
- echo shar: Extracting \"'copy.txt'\" \(81 characters\)
- sed "s/^X//" >'copy.txt' <<'END_OF_FILE'
- XCopying is done by the "cp" command, which has the following usage:
- X$ cp from to
- END_OF_FILE
- if test 81 -ne `wc -c <'copy.txt'`; then
- echo shar: \"'copy.txt'\" unpacked with wrong size!
- fi
- # end of 'copy.txt'
- fi
- if test -f 'cp.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cp.txt'\"
- else
- echo shar: Extracting \"'cp.txt'\" \(81 characters\)
- sed "s/^X//" >'cp.txt' <<'END_OF_FILE'
- XCopying is done by the "cp" command, which has the following usage:
- X$ cp from to
- END_OF_FILE
- if test 81 -ne `wc -c <'cp.txt'`; then
- echo shar: \"'cp.txt'\" unpacked with wrong size!
- fi
- # end of 'cp.txt'
- fi
- if test -f 'csh.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'csh.txt'\"
- else
- echo shar: Extracting \"'csh.txt'\" \(187 characters\)
- sed "s/^X//" >'csh.txt' <<'END_OF_FILE'
- XCsh is the command-line interpreter. It is to Unix what DCL is
- X(feebly) to VMS. It has history and command-line substitution
- Xfeatures. Consult a Guru for neato tricks to try with csh.
- END_OF_FILE
- if test 187 -ne `wc -c <'csh.txt'`; then
- echo shar: \"'csh.txt'\" unpacked with wrong size!
- fi
- # end of 'csh.txt'
- fi
- if test -f 'dir.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dir.txt'\"
- else
- echo shar: Extracting \"'dir.txt'\" \(107 characters\)
- sed "s/^X//" >'dir.txt' <<'END_OF_FILE'
- XTo list the files in your directory, use one of:
- X% l
- Xor
- X% ll
- Xor
- X% ls
- X(try them all to see the difference).
- END_OF_FILE
- if test 107 -ne `wc -c <'dir.txt'`; then
- echo shar: \"'dir.txt'\" unpacked with wrong size!
- fi
- # end of 'dir.txt'
- fi
- if test -f 'ed.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ed.txt'\"
- else
- echo shar: Extracting \"'ed.txt'\" \(110 characters\)
- sed "s/^X//" >'ed.txt' <<'END_OF_FILE'
- X"ed" is the old, old, line-oriented editor. Vi is the
- Xpreferred editor. Select vi at the next help prompt.
- X
- END_OF_FILE
- if test 110 -ne `wc -c <'ed.txt'`; then
- echo shar: \"'ed.txt'\" unpacked with wrong size!
- fi
- # end of 'ed.txt'
- fi
- if test -f 'edit.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edit.txt'\"
- else
- echo shar: Extracting \"'edit.txt'\" \(85 characters\)
- sed "s/^X//" >'edit.txt' <<'END_OF_FILE'
- XThe editor on the Unix machines is called "vi". For more help
- Xask for help on "vi".
- END_OF_FILE
- if test 85 -ne `wc -c <'edit.txt'`; then
- echo shar: \"'edit.txt'\" unpacked with wrong size!
- fi
- # end of 'edit.txt'
- fi
- if test -f 'exit.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'exit.txt'\"
- else
- echo shar: Extracting \"'exit.txt'\" \(0 characters\)
- sed "s/^X//" >'exit.txt' <<'END_OF_FILE'
- END_OF_FILE
- if test 0 -ne `wc -c <'exit.txt'`; then
- echo shar: \"'exit.txt'\" unpacked with wrong size!
- fi
- # end of 'exit.txt'
- fi
- if test ! -d 'files' ; then
- echo shar: Creating directory \"'files'\"
- mkdir 'files'
- fi
- if test -f 'files.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files.txt'\"
- else
- echo shar: Extracting \"'files.txt'\" \(244 characters\)
- sed "s/^X//" >'files.txt' <<'END_OF_FILE'
- XFiles are stored in a hierarchial manner, beginning with / as the
- Xroot of the filesystem. The major subdivisions are /usr, /usr1,
- X/usr2, and /usr3. Your directory is probably something like
- X/usr3/myname or something similar.
- X
- XSee also "pwd".
- END_OF_FILE
- if test 244 -ne `wc -c <'files.txt'`; then
- echo shar: \"'files.txt'\" unpacked with wrong size!
- fi
- # end of 'files.txt'
- fi
- if test -f 'files/a.out.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/a.out.txt'\"
- else
- echo shar: Extracting \"'files/a.out.txt'\" \(154 characters\)
- sed "s/^X//" >'files/a.out.txt' <<'END_OF_FILE'
- X"a.out" is the resultant executable file created by "cc",
- X"pascal", or "fortran". (Its name is a historical accident --
- Xconsult a Guru for explanation.)
- END_OF_FILE
- if test 154 -ne `wc -c <'files/a.out.txt'`; then
- echo shar: \"'files/a.out.txt'\" unpacked with wrong size!
- fi
- # end of 'files/a.out.txt'
- fi
- if test ! -d 'files/binaries' ; then
- echo shar: Creating directory \"'files/binaries'\"
- mkdir 'files/binaries'
- fi
- if test -f 'files/binaries.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/binaries.txt'\"
- else
- echo shar: Extracting \"'files/binaries.txt'\" \(149 characters\)
- sed "s/^X//" >'files/binaries.txt' <<'END_OF_FILE'
- XBinary files typically are named ".o" files. They are not normally
- Xleft lying around in your directory, except by certain programs,
- Xsuch as "make."
- END_OF_FILE
- if test 149 -ne `wc -c <'files/binaries.txt'`; then
- echo shar: \"'files/binaries.txt'\" unpacked with wrong size!
- fi
- # end of 'files/binaries.txt'
- fi
- if test -f 'files/binaries/a.out.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/binaries/a.out.txt'\"
- else
- echo shar: Extracting \"'files/binaries/a.out.txt'\" \(74 characters\)
- sed "s/^X//" >'files/binaries/a.out.txt' <<'END_OF_FILE'
- XExecutable files are by default named "a.out" and left in your
- Xdirectory.
- END_OF_FILE
- if test 74 -ne `wc -c <'files/binaries/a.out.txt'`; then
- echo shar: \"'files/binaries/a.out.txt'\" unpacked with wrong size!
- fi
- # end of 'files/binaries/a.out.txt'
- fi
- if test -f 'files/binaries/executables.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/binaries/executables.txt'\"
- else
- echo shar: Extracting \"'files/binaries/executables.txt'\" \(74 characters\)
- sed "s/^X//" >'files/binaries/executables.txt' <<'END_OF_FILE'
- XExecutable files are by default named "a.out" and left in your
- Xdirectory.
- END_OF_FILE
- if test 74 -ne `wc -c <'files/binaries/executables.txt'`; then
- echo shar: \"'files/binaries/executables.txt'\" unpacked with wrong size!
- fi
- # end of 'files/binaries/executables.txt'
- fi
- if test -f 'files/filenames.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/filenames.txt'\"
- else
- echo shar: Extracting \"'files/filenames.txt'\" \(532 characters\)
- sed "s/^X//" >'files/filenames.txt' <<'END_OF_FILE'
- XFilenames in Unix may be composed of any characters, even non-
- Xprinting characters (although not so useful). However, conventionally,
- Xfilenames have an "extension" composed of the period and a descriptive
- Xcharacter or characters. For example, C-language programs must
- Xbe named a name whose last two characters are ".c". Note that this
- Xis not really an "extension"; it's just that the last two characters
- Xof the filename are "." and "c". Pascal programs may be named
- Xending in ".pas" or ".p" . Fortran programs must end in ".f"
- END_OF_FILE
- if test 532 -ne `wc -c <'files/filenames.txt'`; then
- echo shar: \"'files/filenames.txt'\" unpacked with wrong size!
- fi
- # end of 'files/filenames.txt'
- fi
- if test -f 'files/pwd.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/pwd.txt'\"
- else
- echo shar: Extracting \"'files/pwd.txt'\" \(132 characters\)
- sed "s/^X//" >'files/pwd.txt' <<'END_OF_FILE'
- XPwd tells you what directory is your current directory
- X("p"rint "w"orking "d"irectory). This is how you
- X"find out where you are".
- X
- END_OF_FILE
- if test 132 -ne `wc -c <'files/pwd.txt'`; then
- echo shar: \"'files/pwd.txt'\" unpacked with wrong size!
- fi
- # end of 'files/pwd.txt'
- fi
- if test -f 'files/sources.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'files/sources.txt'\"
- else
- echo shar: Extracting \"'files/sources.txt'\" \(640 characters\)
- sed "s/^X//" >'files/sources.txt' <<'END_OF_FILE'
- XSource files are usually created by typing them into the computer
- Xusing an editor, such as "vi".
- XSource files in the Pascal language must end with ".p" or ".pas".
- XSource files in the C language must end with ".c".
- XSource files in the FORTRAN language must end with ".f".
- XNote that these are not "extensions" (Unix has no concept of
- X"extensions"). They simply are the last few characters of
- Xthe filename. Filenames may be up to 255 characters long (not
- Xrecommended) and may consist of any characters, although you'll
- Xhave trouble with the shell if you stick, for example, "&" or
- X"*" in any of your filenames; "." and "-" are fine, though.
- END_OF_FILE
- if test 640 -ne `wc -c <'files/sources.txt'`; then
- echo shar: \"'files/sources.txt'\" unpacked with wrong size!
- fi
- # end of 'files/sources.txt'
- fi
- if test -f 'fortran.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'fortran.txt'\"
- else
- echo shar: Extracting \"'fortran.txt'\" \(107 characters\)
- sed "s/^X//" >'fortran.txt' <<'END_OF_FILE'
- XThe fortran compiler is invoked by
- X$ fortran filename.f
- XThe executable is named "a.out" in your directory.
- END_OF_FILE
- if test 107 -ne `wc -c <'fortran.txt'`; then
- echo shar: \"'fortran.txt'\" unpacked with wrong size!
- fi
- # end of 'fortran.txt'
- fi
- if test -f 'games.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'games.txt'\"
- else
- echo shar: Extracting \"'games.txt'\" \(316 characters\)
- sed "s/^X//" >'games.txt' <<'END_OF_FILE'
- XWe have OODLES and OODLES of games (well, those that can be
- Xplayed on 24 line X 80 column terminals). We got chess,
- Xbackgammon, hack, rogue, greed, and lots more. To see
- Xwhat games you can play, type
- X% l /usr/games
- X
- XUsually, if it is an executable game, its name will end in *,
- Xso to play it, just type its name.
- X
- END_OF_FILE
- if test 316 -ne `wc -c <'games.txt'`; then
- echo shar: \"'games.txt'\" unpacked with wrong size!
- fi
- # end of 'games.txt'
- fi
- if test -f 'guru' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'guru'\"
- else
- echo shar: Extracting \"'guru'\" \(23 characters\)
- sed "s/^X//" >'guru' <<'END_OF_FILE'
- Xulgrp 0 | grep -v root
- END_OF_FILE
- if test 23 -ne `wc -c <'guru'`; then
- echo shar: \"'guru'\" unpacked with wrong size!
- fi
- chmod +x 'guru'
- # end of 'guru'
- fi
- if test -f 'guru.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'guru.1'\"
- else
- echo shar: Extracting \"'guru.1'\" \(229 characters\)
- sed "s/^X//" >'guru.1' <<'END_OF_FILE'
- X.TH GURU 1 Local
- X.UC 4
- X.SH NAME
- Xguru \- Gurus list
- X.SH SYNOPSIS
- X.B guru
- X.SH DESCRIPTION
- XLooks in /etc/passwd for users with group id's of "root".
- X.SH AUTHOR
- XJ. Nelson, UNCW, 5 Jul 89
- X.SH BUGS
- XAlso reports Igors along with Guru.
- END_OF_FILE
- if test 229 -ne `wc -c <'guru.1'`; then
- echo shar: \"'guru.1'\" unpacked with wrong size!
- fi
- # end of 'guru.1'
- fi
- if test -f 'guru.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'guru.txt'\"
- else
- echo shar: Extracting \"'guru.txt'\" \(180 characters\)
- sed "s/^X//" >'guru.txt' <<'END_OF_FILE'
- XGurus are those professors and students who have transcended
- Xmere worldly OS and C-hacking and have achieved a higher plane.
- XFor a current list, consult a Guru.
- X
- XSee also "igors".
- END_OF_FILE
- if test 180 -ne `wc -c <'guru.txt'`; then
- echo shar: \"'guru.txt'\" unpacked with wrong size!
- fi
- # end of 'guru.txt'
- fi
- if test -f 'help.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'help.c'\"
- else
- echo shar: Extracting \"'help.c'\" \(1512 characters\)
- sed "s/^X//" >'help.c' <<'END_OF_FILE'
- X#include <sys/types.h>
- X#include <sys/dir.h>
- X#include <stdio.h>
- X#include <string.h>
- Xchar *zork[300];
- Xmain(argc,argv)
- Xchar **argv;
- X{
- X int arcnt,level,k;
- X char line[133],fnd[133];
- X k=chdir(LIBDIR);
- X if(k<0)exit(1);
- X level=0;
- X arcnt=1;
- X for(;;){
- X if(arcnt>=argc) {
- X puts("");
- X if(level)printf("Further ");
- X puts(
- X "Help is available for the following topics:");
- X if(listfd(1)<0)exit(1);
- X printf("\nHelp on what topic? ");
- X gets(line);
- X }
- X else{
- X printf("%s:\n",argv[arcnt]);
- X if(listfd(0)<0)exit(1);
- X strcpy(line,argv[arcnt]);
- X arcnt++;
- X }
- X if(strlen(line)>0){
- X k=completion(line,zork);
- X freezork(zork);
- X if(!k)continue;
- X if(!strcmp(line,"q") ||
- X !strcmp(line,"quit") ||
- X !strcmp(line,"exit"))exit(0);
- X if(line[0]=='!'){
- X strcpy(fnd,"man ");
- X strcat(fnd,&line[1]);
- X system(fnd);
- X continue;
- X }
- X }
- X if((k=strlen(line))==0 && level==0)exit(1);
- X if(k==0){
- X level--;
- X chdir("..");
- X continue;
- X }
- X strcpy(fnd,line);
- X strcat(line,".txt");
- X if(mymode(line)){
- X if(listit(line)<0)exit(1);
- X }
- X if(mymode(fnd)&040000){
- X /* printf("\nFurther ");*/
- X chdir(fnd);
- X level++;
- X }
- X }
- X}
- Xfreezork(p)
- Xchar **p;
- X{
- X while(*p){
- X free(*p);
- X *p = (char *)0;
- X p++;
- X }
- X}
- Xcompletion(line,p)
- Xchar *line;
- Xchar **p;
- X{
- X int i,j,count=0;
- X char *q;
- X q=line;
- X if(*q=='!')q++;
- X for(i=0;p[i];i++)if(kindex(p[i],q)==0){
- X if(strcmp(p[i],q)==0)return 1;
- X count++;
- X j=i;
- X }
- X if(count!=1){
- X printf("ambiguous\n");
- X return 0;
- X }
- X strcpy(q,p[j]);
- X return 1;
- X
- X}
- X
- END_OF_FILE
- if test 1512 -ne `wc -c <'help.c'`; then
- echo shar: \"'help.c'\" unpacked with wrong size!
- fi
- # end of 'help.c'
- fi
- if test -f 'help.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'help.txt'\"
- else
- echo shar: Extracting \"'help.txt'\" \(284 characters\)
- sed "s/^X//" >'help.txt' <<'END_OF_FILE'
- XYou are using the help command right now. To move down to sub-
- Xtopics, select the sub-topic; to move back up to the parent topic,
- Xjust type <return>. To get the man-page for a topic, type
- X!topic (that is, for example, to get the man-page for "cp"),
- Xtype !cp at the "topic?" prompt.
- END_OF_FILE
- if test 284 -ne `wc -c <'help.txt'`; then
- echo shar: \"'help.txt'\" unpacked with wrong size!
- fi
- # end of 'help.txt'
- fi
- if test -f 'igors' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'igors'\"
- else
- echo shar: Extracting \"'igors'\" \(23 characters\)
- sed "s/^X//" >'igors' <<'END_OF_FILE'
- Xulgrp 0 | grep -v root
- END_OF_FILE
- if test 23 -ne `wc -c <'igors'`; then
- echo shar: \"'igors'\" unpacked with wrong size!
- fi
- chmod +x 'igors'
- # end of 'igors'
- fi
- if test -f 'igors.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'igors.1'\"
- else
- echo shar: Extracting \"'igors.1'\" \(383 characters\)
- sed "s/^X//" >'igors.1' <<'END_OF_FILE'
- X.TH IGORS 1 Local
- X.UC 4
- X.SH NAME
- Xigors \- apprentice Gurus list
- X.SH SYNOPSIS
- X.B igors
- X.SH DESCRIPTION
- XLooks in /etc/passwd for users with group id's of "root".
- X.SH AUTHOR
- XJ. Nelson, UNCW, 5 Jul 89
- X.SH BUGS
- XAlso reports Gurus along with Igors. Igors are those who can
- Xbe considered Gurus on some subjects but not others. Gurus
- Xwill admit to no such limitation, rightly or wrongly ...
- END_OF_FILE
- if test 383 -ne `wc -c <'igors.1'`; then
- echo shar: \"'igors.1'\" unpacked with wrong size!
- fi
- # end of 'igors.1'
- fi
- if test -f 'igors.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'igors.txt'\"
- else
- echo shar: Extracting \"'igors.txt'\" \(156 characters\)
- sed "s/^X//" >'igors.txt' <<'END_OF_FILE'
- XThe "igors" are those students who classify as Gurus or
- Xsemi-Gurus (as in "Igor! Fetch me a brain!). For a current
- Xlist, consult a Guru.
- X
- XSee also "guru".
- END_OF_FILE
- if test 156 -ne `wc -c <'igors.txt'`; then
- echo shar: \"'igors.txt'\" unpacked with wrong size!
- fi
- # end of 'igors.txt'
- fi
- if test -f 'kindex.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'kindex.c'\"
- else
- echo shar: Extracting \"'kindex.c'\" \(427 characters\)
- sed "s/^X//" >'kindex.c' <<'END_OF_FILE'
- Xkindex(s,t)
- Xchar s[],t[];
- X{
- X int c,i,j,k;
- X c=s[0];
- X if(c==0){return -1;
- X/* i=puts("in kindex ... dummy, s[0] is zero");j=i;*/
- X/* puts(t);*/
- X/* if(i==j)exit(1);*/
- X }
- X c=t[0];
- X if(c==0){return -1;
- X/* i=puts("in kindex ... dummy, t[0] is zero");j=i;*/
- X/* puts(s);*/
- X/* if(j==i)exit(1);*/
- X }
- X for(i=0;s[i] !='\0'; i++){
- X for(j=i,k=0;t[k] !='\0' && s[j]==t[k];j++,k++)
- X ;
- X if(t[k]=='\0')return (i);
- X }
- X return(-1);
- X}
- END_OF_FILE
- if test 427 -ne `wc -c <'kindex.c'`; then
- echo shar: \"'kindex.c'\" unpacked with wrong size!
- fi
- # end of 'kindex.c'
- fi
- if test -f 'languages.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'languages.txt'\"
- else
- echo shar: Extracting \"'languages.txt'\" \(283 characters\)
- sed "s/^X//" >'languages.txt' <<'END_OF_FILE'
- XThere are three officially supported languages on this machine:
- XFORTRAN, C, and Pascal. Ada is on loan from Sequent, and may
- Xbe returned at any time. Awk and Perl may be considered by some
- Xto be languages. We do not have BASIC, nor are we ever likely to.
- XC++ may be coming later.
- END_OF_FILE
- if test 283 -ne `wc -c <'languages.txt'`; then
- echo shar: \"'languages.txt'\" unpacked with wrong size!
- fi
- # end of 'languages.txt'
- fi
- if test -f 'learn.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'learn.txt'\"
- else
- echo shar: Extracting \"'learn.txt'\" \(158 characters\)
- sed "s/^X//" >'learn.txt' <<'END_OF_FILE'
- XThe "learn" program is (designed to be) self-explanatory. It has
- Xa number of courses to learn about files, C, and so forth. Type
- X% learn
- Xand go from there.
- END_OF_FILE
- if test 158 -ne `wc -c <'learn.txt'`; then
- echo shar: \"'learn.txt'\" unpacked with wrong size!
- fi
- # end of 'learn.txt'
- fi
- if test -f 'less.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'less.txt'\"
- else
- echo shar: Extracting \"'less.txt'\" \(251 characters\)
- sed "s/^X//" >'less.txt' <<'END_OF_FILE'
- X"less" is a nice program which copies text to the terminal a screenful
- Xat a time, then awaits a command. <space> goes on to the next
- Xscreenful; "b" goes back one screenful; "G" goes to the end of
- Xthe input file, etc. For more info see the man-page.
- END_OF_FILE
- if test 251 -ne `wc -c <'less.txt'`; then
- echo shar: \"'less.txt'\" unpacked with wrong size!
- fi
- # end of 'less.txt'
- fi
- if test -f 'listfd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'listfd.c'\"
- else
- echo shar: Extracting \"'listfd.c'\" \(3730 characters\)
- sed "s/^X//" >'listfd.c' <<'END_OF_FILE'
- X#ifndef OLDDIR
- X#include <sys/types.h>
- X#include <stdio.h>
- X#include <sys/stat.h>
- X#include <string.h>
- X#ifdef SYSV
- X#include <dirent.h>
- X#endif
- X#include <sys/dir.h>
- Xlistfd(yesprint)
- X/* list files only of type "file" in the current directory */
- X/* the "yesprint" thing is a horrible kludge, added to correct
- X a horrible kludge when the filename-completion was added ...
- X ad nauseam */
- X{
- X DIR *dirp;
- X char line[233],fnmine[833];
- X int k;
- X#ifdef SYSV
- X struct dirent dir, *p, *readdir();
- X#else
- X struct direct dir, *p, *readdir();
- X#endif
- X char *fn, *fgets();
- X extern char *zork[300];
- X int i;
- X char *malloc();
- X
- X
- X p= &dir;
- X dirp=opendir(".");
- X if(dirp==NULL){
- X return(-1);
- X }
- X line[0]=0;
- X i=0;
- X zork[i]=(char * )0;
- X while(p=readdir(dirp))
- X {
- X fn=p->d_name;
- X /* fprintf(stderr,"fn=%x,p=%x,p->d_name=%x, *fn=%c\n",*/
- X /* fn,p,p->d_name,*fn);*/
- X /* {int i;for(i=0;i<5;i++)fprintf(stderr,"%o ",fn[i]);}*/
- X if(*fn=='.')continue;
- X if(mymode(fn)&040000) /*it's a dir*/continue;
- X if((k=kindex(fn,".txt"))<0)continue;
- X (void)strcpy(fnmine,fn);
- X fnmine[k]=0;
- X /* puts(fnmine);*/
- X zork[i]=malloc((unsigned)strlen(fnmine)+1);
- X if(!zork[i])exit(1);
- X (void)strcpy(zork[i],fnmine);
- X /* puts(zork[i]);*/
- X i++;
- X zork[i]=(char * )0;
- X }
- X closedir(dirp);
- X /* puts(line);*/
- X mydumbsort(zork);
- X line[0]=0;
- X for(i=0;zork[i];i++)
- X {
- X int jim;
- X strcat(line,zork[i]);
- X/* free(zork[i]);*/
- X strcat(line," ");
- X jim=strlen(line);
- X if(jim>65){
- X if(yesprint)puts(line);
- X line[0]=0;
- X }
- X jim=strlen(line);
- X while( (jim%9) ){
- X strcat(line," ");
- X jim++;
- X }
- X if(jim>65){
- X if(yesprint)puts(line);
- X line[0]=0;
- X }
- X /* if((i%5)==4){*/
- X /**/
- X /* puts(line);*/
- X /* line[0]=0;*/
- X /* }*/
- X
- X }
- X if(yesprint)puts(line);
- X return 1;
- X}
- Xmydumbsort(p)
- Xchar **p;
- X{
- X /*dumb bubble sort of pointers*/
- X int i,j,n;
- X char *t;
- X if(p[0]==(char*)0)return; /*no elements*/
- X if(p[1]==(char*)0)return; /* one element*/
- X for(i=0;p[i];i++) ;
- X n=i;
- X for(i=0;i<n-1;i++)
- X for(j=i+1;j<n;j++)
- X /* if(*p[i]< *p[j]){*/
- X if(strcmp(p[i],p[j])>0){
- X t=p[i];
- X p[i]=p[j];
- X p[j]=t;
- X
- X }
- X
- X}
- X#else
- X/* this is an entire replacement for listfd() for old-
- Xstyle 14-character name, 2-byte inode no. style directories */
- Xlistfd(yesprint)
- X/* list files only of type "file" in the current directory */
- X{
- X char line[233],fnmine[833];
- X int k;
- X char *fn, *fgets();
- X extern char *zork[300];
- X int i,fd;
- X char *malloc();
- X char mumble[17];
- X
- X
- X fd=open(".",0);
- X
- X if(fd<0){
- X return(-1);
- X }
- X line[0]=0;
- X i=0;
- X zork[i]=(char * )0;
- X while( read(fd,mumble,16)==16)
- X {
- X if(mumble[0]==0&&mumble[1]==0)continue;/*zeroed inode no.*/
- X fn= mumble+2;/*filename*/
- X mumble[16]=0;/*make sure null terminated*/
- X if(*fn=='.')continue;/*skip all dot files*/
- X if(mymode(fn)&040000) /*it's a dir*/continue;
- X if((k=kindex(fn,".txt"))<0)continue;
- X (void)strcpy(fnmine,fn);
- X fnmine[k]=0;
- X zork[i]=malloc((unsigned)strlen(fnmine)+1);
- X if(!zork[i])exit(1);
- X (void)strcpy(zork[i],fnmine);
- X i++;
- X zork[i]=(char * )0;
- X }/*end while*/
- X i=close(fd);
- X if(i<0)exit(7);
- X mydumbsort(zork);
- X line[0]=0;
- X for(i=0;zork[i];i++)
- X {
- X int jim;
- X strcat(line,zork[i]);
- X/* free(zork[i]);*/
- X strcat(line," ");
- X jim=strlen(line);
- X if(jim>65){
- X if(yesprint)puts(line);
- X line[0]=0;
- X }
- X jim=strlen(line);
- X while( (jim%9) ){
- X strcat(line," ");
- X jim++;
- X }
- X if(jim>65){
- X if(yesprint)puts(line);
- X line[0]=0;
- X }
- X
- X }
- X if(yesprint)puts(line);
- X return 1;
- X}
- Xmydumbsort(p)
- Xchar **p;
- X{
- X /*dumb bubble sort of pointers*/
- X int i,j,n;
- X char *t;
- X if(p[0]==(char*)0)return; /*no elements*/
- X if(p[1]==(char*)0)return; /* one element*/
- X for(i=0;p[i];i++) ;
- X n=i;
- X for(i=0;i<n-1;i++)
- X for(j=i+1;j<n;j++)
- X if(strcmp(p[i],p[j])>0){
- X t=p[i];
- X p[i]=p[j];
- X p[j]=t;
- X
- X }
- X
- X}
- X#endif
- END_OF_FILE
- if test 3730 -ne `wc -c <'listfd.c'`; then
- echo shar: \"'listfd.c'\" unpacked with wrong size!
- fi
- # end of 'listfd.c'
- fi
- if test -f 'listit.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'listit.c'\"
- else
- echo shar: Extracting \"'listit.c'\" \(454 characters\)
- sed "s/^X//" >'listit.c' <<'END_OF_FILE'
- X#include <stdio.h>
- Xlistit(fn)
- Xchar *fn;
- X{
- X int i;
- X char line[153];
- X FILE *fp;
- X fp=fopen(fn,"r");
- X if(fp==(FILE *)0)return(-1);
- X puts("");
- X i=0;
- X while(fgets(line,132,fp)==line)
- X {
- X i++;
- X if( (i%21)==0 ){
- X int c;
- X printf("---more---");
- X fflush(stdout);
- X cbreak();
- X c=getchar();
- X nocbreak();
- X/* puts("");*/
- X printf("\r \r");
- X if(c=='q')goto out;
- X
- X }
- X printf("%s",line);
- X }
- Xout:
- X if(fp)if(fclose(fp)<0)exit(1);
- X return 0;
- X}
- END_OF_FILE
- if test 454 -ne `wc -c <'listit.c'`; then
- echo shar: \"'listit.c'\" unpacked with wrong size!
- fi
- # end of 'listit.c'
- fi
- if test -f 'logoff.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'logoff.txt'\"
- else
- echo shar: Extracting \"'logoff.txt'\" \(273 characters\)
- sed "s/^X//" >'logoff.txt' <<'END_OF_FILE'
- XYou log off the Unix machines by typing control-d at the
- Xcommand line prompt. (To type control-d, you HOLD DOWN the
- X"control" key WHILE typing "d"; this is not a two-stroke
- Xsequence -- it's a one-keystroke sequence made by holding
- Xdown the first while typing the second).
- END_OF_FILE
- if test 273 -ne `wc -c <'logoff.txt'`; then
- echo shar: \"'logoff.txt'\" unpacked with wrong size!
- fi
- # end of 'logoff.txt'
- fi
- if test -f 'logout.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'logout.txt'\"
- else
- echo shar: Extracting \"'logout.txt'\" \(273 characters\)
- sed "s/^X//" >'logout.txt' <<'END_OF_FILE'
- XYou log off the Unix machines by typing control-d at the
- Xcommand line prompt. (To type control-d, you HOLD DOWN the
- X"control" key WHILE typing "d"; this is not a two-stroke
- Xsequence -- it's a one-keystroke sequence made by holding
- Xdown the first while typing the second).
- END_OF_FILE
- if test 273 -ne `wc -c <'logout.txt'`; then
- echo shar: \"'logout.txt'\" unpacked with wrong size!
- fi
- # end of 'logout.txt'
- fi
- if test -f 'mail.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mail.txt'\"
- else
- echo shar: Extracting \"'mail.txt'\" \(420 characters\)
- sed "s/^X//" >'mail.txt' <<'END_OF_FILE'
- XMail is just that: mail a message to another user. Mail will
- Xboth send and receive mail. Be advised, however, that mail
- Xis NOT private. It's more like a message-passing bulletin
- Xboard. Do not mail secret things. Mail is most often used
- Xby professors to mail assignments, etc., to classes. Mail
- Xalso can be used to send messages anywhere in the world.
- XConsult a Guru for permission/how-to on this powerful feature.
- END_OF_FILE
- if test 420 -ne `wc -c <'mail.txt'`; then
- echo shar: \"'mail.txt'\" unpacked with wrong size!
- fi
- # end of 'mail.txt'
- fi
- if test -f 'man.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man.txt'\"
- else
- echo shar: Extracting \"'man.txt'\" \(555 characters\)
- sed "s/^X//" >'man.txt' <<'END_OF_FILE'
- XUnix boxes which have sufficient disk storage (Hi, Doug!) keep
- Xthe manual on disk. Unix traditionally has what are called "the
- Xman-pages". Most programs have a one-page manual entry, although
- Xin later years, some programs have come with fifty-page entries.
- XTo get a manual page for a particular program, use
- X$ man programname
- X
- XSee also "apropos".
- X
- XYou can get the manual page from within help by typing
- X!subject when help asks for a topic (well, dummy, you
- Xdon't actually type "subject"; you replace it with what
- Xyou want the man page for ... hmmmph!).
- END_OF_FILE
- if test 555 -ne `wc -c <'man.txt'`; then
- echo shar: \"'man.txt'\" unpacked with wrong size!
- fi
- # end of 'man.txt'
- fi
- if test -f 'manual.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'manual.txt'\"
- else
- echo shar: Extracting \"'manual.txt'\" \(555 characters\)
- sed "s/^X//" >'manual.txt' <<'END_OF_FILE'
- XUnix boxes which have sufficient disk storage (Hi, Doug!) keep
- Xthe manual on disk. Unix traditionally has what are called "the
- Xman-pages". Most programs have a one-page manual entry, although
- Xin later years, some programs have come with fifty-page entries.
- XTo get a manual page for a particular program, use
- X$ man programname
- X
- XSee also "apropos".
- X
- XYou can get the manual page from within help by typing
- X!subject when help asks for a topic (well, dummy, you
- Xdon't actually type "subject"; you replace it with what
- Xyou want the man page for ... hmmmph!).
- END_OF_FILE
- if test 555 -ne `wc -c <'manual.txt'`; then
- echo shar: \"'manual.txt'\" unpacked with wrong size!
- fi
- # end of 'manual.txt'
- fi
- if test -f 'mv.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mv.txt'\"
- else
- echo shar: Extracting \"'mv.txt'\" \(218 characters\)
- sed "s/^X//" >'mv.txt' <<'END_OF_FILE'
- XRename is accomplished by use of the "mv" command. Don't ask
- Xwhy the command is named "mv" instead of "rename", it just is.
- XUsage:
- X$ mv from to
- Xeffectively renames "from" to be "to".
- XIt does a copy and then a delete.
- END_OF_FILE
- if test 218 -ne `wc -c <'mv.txt'`; then
- echo shar: \"'mv.txt'\" unpacked with wrong size!
- fi
- # end of 'mv.txt'
- fi
- if test -f 'mymode.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mymode.c'\"
- else
- echo shar: Extracting \"'mymode.c'\" \(335 characters\)
- sed "s/^X//" >'mymode.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X
- Xmymode(p)
- Xchar *p;
- X{
- X
- X struct stat buf;
- X struct stat *pb = &buf;
- X#ifndef SYSV
- X if(lstat(p,pb)== -1)
- X#else
- X if(stat(p,pb)== -1)
- X#endif
- X {
- X/* fprintf(stderr,"lstat: %s not found\n",p);*/
- X return 0;
- X }
- X/* fprintf(stderr,"mode=%o\n",pb->st_mode);*/
- X return pb->st_mode;
- X}
- END_OF_FILE
- if test 335 -ne `wc -c <'mymode.c'`; then
- echo shar: \"'mymode.c'\" unpacked with wrong size!
- fi
- # end of 'mymode.c'
- fi
- if test -f 'news.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'news.txt'\"
- else
- echo shar: Extracting \"'news.txt'\" \(526 characters\)
- sed "s/^X//" >'news.txt' <<'END_OF_FILE'
- XThe "news" refers to the posted articles in a network usually referred
- Xto as "usenet". These articles are arranged into a hierarchy of
- Xsubjects, topics, etc., and come from all over the world. UNCW
- Xreceives the "news" from a big vax up in the Triangle every morning
- Xbeginning at at 0249. To read the news, you may use any one of several
- X"news-reader" programs. The two most popular seem to be "rn" and
- X"nn". I recommend "nn" for the beginner, as it is less formidable to
- Xget started. Just type
- X% nn
- Xand go from there.
- END_OF_FILE
- if test 526 -ne `wc -c <'news.txt'`; then
- echo shar: \"'news.txt'\" unpacked with wrong size!
- fi
- # end of 'news.txt'
- fi
- if test -f 'nocbreak.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'nocbreak.c'\"
- else
- echo shar: Extracting \"'nocbreak.c'\" \(308 characters\)
- sed "s/^X//" >'nocbreak.c' <<'END_OF_FILE'
- X#ifdef sequent
- X#include <sgtty.h>
- X
- Xnocbreak()
- X{
- X int i;
- X struct sgttyb ttystatus;
- X char *a;
- X a= &ttystatus.sg_ispeed;
- X i=ioctl(0,TIOCGETP,a);
- X if(i<0)exit(5);
- X
- X#define F ttystatus.sg_flags
- X F ^= CBREAK;
- X i=ioctl(0,TIOCSETP,a);
- X if(i<0)exit(6);
- X}
- X#else
- Xnocbreak(){
- X while(getchar()!='\n') /*null*/ ;
- X}
- X#endif
- END_OF_FILE
- if test 308 -ne `wc -c <'nocbreak.c'`; then
- echo shar: \"'nocbreak.c'\" unpacked with wrong size!
- fi
- # end of 'nocbreak.c'
- fi
- if test -f 'off.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'off.txt'\"
- else
- echo shar: Extracting \"'off.txt'\" \(273 characters\)
- sed "s/^X//" >'off.txt' <<'END_OF_FILE'
- XYou log off the Unix machines by typing control-d at the
- Xcommand line prompt. (To type control-d, you HOLD DOWN the
- X"control" key WHILE typing "d"; this is not a two-stroke
- Xsequence -- it's a one-keystroke sequence made by holding
- Xdown the first while typing the second).
- END_OF_FILE
- if test 273 -ne `wc -c <'off.txt'`; then
- echo shar: \"'off.txt'\" unpacked with wrong size!
- fi
- # end of 'off.txt'
- fi
- if test -f 'pascal.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'pascal.txt'\"
- else
- echo shar: Extracting \"'pascal.txt'\" \(121 characters\)
- sed "s/^X//" >'pascal.txt' <<'END_OF_FILE'
- XThe pascal compiler is invoked by
- X$ pascal filename.p
- XThe executable is named "a.out" in your directory.
- X
- XSee also "ap".
- END_OF_FILE
- if test 121 -ne `wc -c <'pascal.txt'`; then
- echo shar: \"'pascal.txt'\" unpacked with wrong size!
- fi
- # end of 'pascal.txt'
- fi
- if test -f 'passwd.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'passwd.txt'\"
- else
- echo shar: Extracting \"'passwd.txt'\" \(93 characters\)
- sed "s/^X//" >'passwd.txt' <<'END_OF_FILE'
- XThe command to change your password is
- X$ passwd
- XNote the spelling: "passwd", not "password".
- END_OF_FILE
- if test 93 -ne `wc -c <'passwd.txt'`; then
- echo shar: \"'passwd.txt'\" unpacked with wrong size!
- fi
- # end of 'passwd.txt'
- fi
- if test -f 'phone.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'phone.txt'\"
- else
- echo shar: Extracting \"'phone.txt'\" \(273 characters\)
- sed "s/^X//" >'phone.txt' <<'END_OF_FILE'
- XYou can talk or phone another logged in user just by typing
- X% phone joeblow
- XYour target talkee should respond with
- X% phone whoeveryouare
- XNote that your target talkee may be refusing phone calls,
- Xif he/she has executed the 'mesg n' command.
- X
- XPhone and talk are synonymous.
- X
- END_OF_FILE
- if test 273 -ne `wc -c <'phone.txt'`; then
- echo shar: \"'phone.txt'\" unpacked with wrong size!
- fi
- # end of 'phone.txt'
- fi
- if test -f 'pwd.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'pwd.txt'\"
- else
- echo shar: Extracting \"'pwd.txt'\" \(132 characters\)
- sed "s/^X//" >'pwd.txt' <<'END_OF_FILE'
- XPwd tells you what directory is your current directory
- X("p"rint "w"orking "d"irectory). This is how you
- X"find out where you are".
- X
- END_OF_FILE
- if test 132 -ne `wc -c <'pwd.txt'`; then
- echo shar: \"'pwd.txt'\" unpacked with wrong size!
- fi
- # end of 'pwd.txt'
- fi
- if test -f 'quit.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'quit.txt'\"
- else
- echo shar: Extracting \"'quit.txt'\" \(0 characters\)
- sed "s/^X//" >'quit.txt' <<'END_OF_FILE'
- END_OF_FILE
- if test 0 -ne `wc -c <'quit.txt'`; then
- echo shar: \"'quit.txt'\" unpacked with wrong size!
- fi
- # end of 'quit.txt'
- fi
- if test -f 'rename.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'rename.txt'\"
- else
- echo shar: Extracting \"'rename.txt'\" \(218 characters\)
- sed "s/^X//" >'rename.txt' <<'END_OF_FILE'
- XRename is accomplished by use of the "mv" command. Don't ask
- Xwhy the command is named "mv" instead of "rename", it just is.
- XUsage:
- X$ mv from to
- Xeffectively renames "from" to be "to".
- XIt does a copy and then a delete.
- END_OF_FILE
- if test 218 -ne `wc -c <'rename.txt'`; then
- echo shar: \"'rename.txt'\" unpacked with wrong size!
- fi
- # end of 'rename.txt'
- fi
- if test -f 'stat.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'stat.c'\"
- else
- echo shar: Extracting \"'stat.c'\" \(1479 characters\)
- sed "s/^X//" >'stat.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar *argv[];
- X{
- X
- X int laststat=1,i=1;
- X char *name;
- X struct stat buf;
- X struct stat *pb = &buf;
- X if(argc<=1)
- X {
- X printf("requires an argument\n");
- X exit(1);
- X }
- X for(i=1;i<argc;i++)
- X {
- X name = argv[i];
- X if(lstat(name,pb)== -1)
- X printf("lstat: %s not found, i=%d\n",name,i);
- X else
- X {
- X printstat(pb,name);
- X if((pb->st_mode&S_IFLNK)==S_IFLNK)
- X {
- X char realname[257]; int i,jhn;
- X for(i=0;i<257;i++)realname[i]='\0';
- X readlink(name,realname,257);
- X printf(
- X "---symbolic link, here's what it points to:---\n");
- X laststat=0;/*for exiting with 0 status (true)*/
- X jhn=stat(name,pb);
- X if(jhn==0)
- X printstat(pb,realname);
- X else {printf("\"%s\" not found--this could be a real problem!!\n",realname);exit(1);}
- X }
- X else
- X laststat=1; /*for exiting with false status*/
- X }
- X }
- X exit(laststat);
- X}
- Xprintstat(pb,name)
- Xstruct stat *pb;
- Xchar *name;
- X{
- X char *ptime, *ctime();
- X printf("%s: ---------\n",name);
- X printf("file-mode=%o(oct) inode=%d st_dev=%x(hex) #links=%d\n",
- X pb->st_mode,
- X pb->st_ino,
- X pb->st_dev,
- X pb->st_nlink);
- X printf("owner=%d group=%d filesize=%d bytes\n",
- X pb->st_uid,pb->st_gid,pb->st_size);
- X ptime=ctime(&(pb->st_atime));
- X printf("data last accessed %s",ptime);
- X ptime=ctime(&(pb->st_mtime));
- X printf("data last modified %s",ptime);
- X ptime=ctime(&(pb->st_ctime));
- X printf("file status last changed %s",ptime);
- X}
- END_OF_FILE
- if test 1479 -ne `wc -c <'stat.c'`; then
- echo shar: \"'stat.c'\" unpacked with wrong size!
- fi
- # end of 'stat.c'
- fi
- if test -f 'talk.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'talk.txt'\"
- else
- echo shar: Extracting \"'talk.txt'\" \(273 characters\)
- sed "s/^X//" >'talk.txt' <<'END_OF_FILE'
- XYou can talk or phone another logged in user just by typing
- X% phone joeblow
- XYour target talkee should respond with
- X% phone whoeveryouare
- XNote that your target talkee may be refusing phone calls,
- Xif he/she has executed the 'mesg n' command.
- X
- XPhone and talk are synonymous.
- X
- END_OF_FILE
- if test 273 -ne `wc -c <'talk.txt'`; then
- echo shar: \"'talk.txt'\" unpacked with wrong size!
- fi
- # end of 'talk.txt'
- fi
- if test -f 'terminal.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'terminal.txt'\"
- else
- echo shar: Extracting \"'terminal.txt'\" \(533 characters\)
- sed "s/^X//" >'terminal.txt' <<'END_OF_FILE'
- XYour terminal can be any one known to this system (last count about
- X391 different kinds), but you must make it known to the system
- Xwhat kind you are using. The command to do that (if your login
- Xsequence doesn't offer you your terminal type) is:
- X% setenv TERM <whatever>
- X
- XYou can see all 391 different names we support by typing:
- X% terminals
- X
- XIn general, the adds viewpoints (black face and keyboard housing) are
- Xtype "av", and the vt200 series (white with ugly green stencilling on
- Xthe sides) can be safely be thought to be vt100s.
- END_OF_FILE
- if test 533 -ne `wc -c <'terminal.txt'`; then
- echo shar: \"'terminal.txt'\" unpacked with wrong size!
- fi
- # end of 'terminal.txt'
- fi
- if test -f 'test.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'test.txt'\"
- else
- echo shar: Extracting \"'test.txt'\" \(298 characters\)
- sed "s/^X//" >'test.txt' <<'END_OF_FILE'
- XTest is useful for testing the existence of files (from within
- Xshell scripts). Be careful not to name your "test" programs
- X"test", because you won't be running your test, you'll be
- Xrunning the system's program called "test".
- XFor example:
- X% cc -o test test.c
- X% test
- Xdoesn't work the way you think.
- END_OF_FILE
- if test 298 -ne `wc -c <'test.txt'`; then
- echo shar: \"'test.txt'\" unpacked with wrong size!
- fi
- # end of 'test.txt'
- fi
- if test -f 'ulgrp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ulgrp'\"
- else
- echo shar: Extracting \"'ulgrp'\" \(263 characters\)
- sed "s/^X//" >'ulgrp' <<'END_OF_FILE'
- X#!/bin/sh
- Xcase $1 in
- X "")
- X awk -F: '{printf "%10s %4d %4d %-15s %-19s %-18s\n",$1,$3,$4,$6,$5,$2}' /etc/passwd|
- Xsort +2n
- X;;
- X *) awk -F: '$4=='$1' {print}' /etc/passwd |
- X awk -F: '{printf "%10s %4d %4d %-15s %-19s\n",$1,$3,$4,$6,$5}' |
- Xsort +0 -1 -b
- X
- X;;
- Xesac
- END_OF_FILE
- if test 263 -ne `wc -c <'ulgrp'`; then
- echo shar: \"'ulgrp'\" unpacked with wrong size!
- fi
- chmod +x 'ulgrp'
- # end of 'ulgrp'
- fi
- if test -f 'vi.txt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vi.txt'\"
- else
- echo shar: Extracting \"'vi.txt'\" \(2347 characters\)
- sed "s/^X//" >'vi.txt' <<'END_OF_FILE'
- XVi is the "visual" editor for the UNIX machines. It differs
- Xfrom the VAX/VMS editor in that vi is a "moded" editor: you
- Xare either in COMMAND MODE or you are in INPUT MODE. In
- XCOMMAND MODE, each keystroke is assumed to be a command; in
- XINPUT MODE, each keystroke is put into the file unless it is
- Xbackspace (the funny "X" key inside the diamond on vt220s) or
- XESCAPE. ESCAPE terminates the INPUT MODE, and puts you back to
- XCOMMAND MODE. If you don't know what mode you're in, hit
- XESCAPE until your terminal beeps. Then you are in COMMAND MODE.
- X
- XIn COMMAND MODE, the most useful commands are:
- Xi<string>ESC -- goes into INPUT MODE until you hit ESCAPE
- Xa<string>ESC -- like "i", but APPENDS (after instead of before)
- Xx -- deletes (x's out) one character
- Xdw -- delete word (up to next blank)
- Xdd -- delete whole line
- Xo -- open a line up after the current line and go to INPUT MODE
- Xr -- replace the char under the cursor with one next character
- XA -- append to end of line (good for putting in forgotten semicolons)
- X0 -- NOTE: zero, not "oh" -- go to beginning of this line
- X$ -- go to end of this line
- XG -- go to last line in file
- X:1 -- go to first line in file
- X^d -- that's control-d -- page down
- X^b -- (control-b) page backward
- X/<string> -- (do not type the < or >) search for <string>
- Xn -- search for next occurrence of previous string
- XZZ -- save edited version of file and exit
- X:wq -- same as ZZ
- Xh -- cursor left
- Xj -- cursor down
- Xk -- cursor up
- Xl -- cursor right
- X
- X NOTE: the arrow keys may work (sometimes, on some, but not
- X all, terminals), but once you get in the habit of using hjkl,
- X you'll like it! -- you don't have to pick up your right hand
- X and move it over to the arrows!! Get used to it!!
- X
- XIn INPUT MODE, a few keys have special meaning:
- XBACKSPACE -- (the funny "X" key on vt220s) -- erase the last character
- X you just typed. This is not the same as "x" in COMMAND MODE.
- XESCAPE -- terminate INPUT MODE, putting you back to COMMAND MODE
- X^d -- undo an auto-indent that just happened
- XNOTE: THE ARROW KEYS ARE INOPERATIVE IN INPUT MODE AND MAY YIELD
- XSTRANGE RESULTS. STAY AWAY FROM THE ARROW KEYS!
- X
- XYou can get several flavors of tutorials on the use of "vi"; there
- Xare a "short" and a "long" help-file which can be dumped to your
- Xscreen by typing
- X% helpvi
- Xand there is, of course, the "learn" tutorial package, as in
- X% learn
- X
- X
- END_OF_FILE
- if test 2347 -ne `wc -c <'vi.txt'`; then
- echo shar: \"'vi.txt'\" unpacked with wrong size!
- fi
- # end of 'vi.txt'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Jim Nelson,UNC-Wilmington,Mathematical Sciences Dept, 919-395-3300
- nelson@uncw.uucp or nelson@ecsvax.uncecs.edu or nelson@ecsvax.bitnet
- or {...,mcnc}!ecsvax!nelson or {...,mcnc}!ecsvax!uncw!nelson
-
-